﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace PhanMemQuanLyThuChi
{
    public partial class frmQuanLyTon : Form
    {
        public frmQuanLyTon()
        {
            InitializeComponent();
        }
        connect cn = new connect();
        private void LoadData()
        {
            gridTienTon.DataSource = cn.GetData("TIENTON_DS");
        }
        private void frmQuanLyTon_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        private void btnThem_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand("TIENTON_INSERT",cn.Connection());
            cmd.CommandType = CommandType.StoredProcedure;
            int thangnext=dtThang.Value.Month+1;
            cmd.Parameters.Add(new SqlParameter("ngayton", SqlDbType.DateTime)).Value = new DateTime(dtThang.Value.Year,thangnext,01);
            cmd.Parameters.Add(new SqlParameter("SoTien",SqlDbType.Float)).Value = txtSoTien.Text;
            cmd.ExecuteNonQuery();
            LoadData();
        }
    }
}
